package Filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * Created by v on 17-5-20.
 */
@WebFilter(filterName = "encodingFilter",value = "/*")
public class EncodingFilter implements Filter{
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        servletRequest.setCharacterEncoding("utf8");
        servletResponse.setContentType("text/html;charset=utf8");
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
